1. Field of the Invention
This invention relates to executing functions and more particularly relates to executing functions in an event driven environment from a co-routine environment context.
2. Description of the Related Art
Software processes are typically designed to function in specific operating environments. For example, many software processes are designed to function in a Return On Completion (ROC) environment. In an ROC environment, a first software process may call or initiate the execution of a second software process. A context state of the first software process is saved to a stack that stores the context state in a last-in-first-out organization. The second software process executes until complete, and then retrieves the context state for the first software process from the stack. The first software process resumes execution.
Software processes may also execute in alternative environments. For example, software processes may execute in an event driven environment that may also be referred to as a real time environment. In the event driven environment, a software process swaps to another software process. The swapping between software processes is initiated and/or controlled by the executing software process as opposed to the typical externally controlled swapping initiated by interrupts or operating system intervention. The event driven environment may be configured to assure that a portion of a software process executes within a specified time interval. In one embodiment, a first software process may swap to the context of a second software process in response to any interrupt rather than call the second software process.
In addition, software processes may be designed to execute in a co-routine environment. The co-routine environment may include a small stack and restrictions on access to resources. As a result, a software process executing in the co-routine environment may more efficient employ the resources of a computing system. Co-routine software processes may also swap contexts from a first software process to a second software process without intervention from an operating system. As used herein, software processes executing in an event driven environment and/or a co-routine environment are referred to as contexts.
Some data processing devices may concurrently employ two or more environments. For example, a data processing device may employ both an event driven environment and a co-routine environment. In such a device, a co-routine environment context may need to execute a function that is configured to execute in the event driven environment. Unfortunately, executing the function in the event driven environment may swap the thread of software execution to the event driven environment prematurely, disrupting the intended instruction flow.